<?
$DontCheckLogin = true;

include_once "gblinclude.lib";
include_once "usershopinfoloaderservice.lib";

ini_set("soap.wsdl_cache_enabled", "0");

class UserShopInfoLoader
{
	public function __construct()
	{
		
	}
	
	public function GetUserGameInfoList($userId)
	{
		global $gblDBConnect;
	
		$maker = new CSqlMaker();
		$maker->setMainTable("tb_user", "user_id", "tblMain", "UserId");
		$maker->addJoinTable("tb_user_shop_info", "tblShopInfo", "JOIN");
		$maker->setJoinCond("tblShopInfo", "tblShopInfo.user_id=tblMain.user_id");
		
		$maker->addSelectColumn("name", "tblMain", "UserName");
		$maker->addSelectColumn("image_src", "tblMain", "Image");
		
		$maker->addSelectColumn("info_id", "tblShopInfo", "InfoId");
		$maker->addSelectColumn("level", "tblShopInfo", "Level");
		$maker->addSelectColumn("score", "tblShopInfo", "Score");
		$maker->addSelectColumn("game_coin", "tblShopInfo", "GameCoin");
		$maker->addSelectColumn("deposit", "tblShopInfo", "Deposit");
		
		$maker->addSearchCond("tblMain", "user_id", "=", $userId, DATA_NUMBER);
		
		$sql = $maker->getSelectSqlStr();
		
		try
		{
			$resObj = $gblDBConnect->getOne($sql);
			
			$userInfoObj = new UserShopInfo();
			$userInfoObj->UserId 	= $resObj["UserId"];
			$userInfoObj->UserName 	= $resObj["UserName"];
			$userInfoObj->UserImage = $resObj["Image"];
			$userInfoObj->InfoId 	= $resObj["InfoId"];
			$userInfoObj->Level 	= $resObj["Level"];
			$userInfoObj->Score 	= $resObj["Score"];
			$userInfoObj->GameCoin 	= $resObj["GameCoin"];
			$userInfoObj->Deposit 	= $resObj["Deposit"];
			
			return $userInfoObj;
		}
		catch(Exception $ex)
		{
			LogError("PDO ERR [Get Fucntion]  ___ ".$ex->getMessage());
			LogError("SQL  ___ ".$sql);
		}
	}
	
	public function GetUserShopInfoList($userId)
	{
		global $gblDBConnect;
	
		$maker = new CSqlMaker();
		$maker->setMainTable("tb_shop", "shop_id", "tblMain", "ShopId");
		
		$maker->addSelectColumn("shop_id", "tblMain", "ShopId");
		$maker->addSelectColumn("name", "tblMain", "Image");
		
		$maker->addSelectColumn("description", "tblShopInfo", "InfoId");
		$maker->addSelectColumn("user_id", "tblShopInfo", "Level");
		$maker->addSelectColumn("scene_id", "tblShopInfo", "Score");
		$maker->addSelectColumn("house_id", "tblShopInfo", "GameCoin");
		
		$maker->addSearchCond("tblMain", "user_id", "=", $userId, DATA_NUMBER);
		
		$sql = $maker->getSelectSqlStr();
		
		try
		{
			$resObj = $gblDBConnect->getAll($sql);
			
			$userInfoObj = new UserShopInfo();
			$userInfoObj->UserId 	= $resObj["UserId"];
			$userInfoObj->UserName 	= $resObj["UserName"];
			$userInfoObj->UserImage = $resObj["Image"];
			$userInfoObj->InfoId 	= $resObj["InfoId"];
			$userInfoObj->Level 	= $resObj["Level"];
			$userInfoObj->Score 	= $resObj["Score"];
			$userInfoObj->GameCoin 	= $resObj["GameCoin"];
			$userInfoObj->Deposit 	= $resObj["Deposit"];
			
			return $userInfoObj;
		}
		catch(Exception $ex)
		{
			LogError("PDO ERR [Get Fucntion]  ___ ".$ex->getMessage());
			LogError("SQL  ___ ".$sql);
		}
	}
}

$servidorSoap = new SoapServer('usershopinfoloaderservice.wsdl');
$servidorSoap->setClass('UserShopInfoLoader');
$servidorSoap->handle();

?>